﻿

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace VisualisationModule.Model
{
    class CenterMessageOptions
    {
        //This class is used as model data
        //to display a list of options for the centermessage

        
        public CenterMessageOptions()
        {
            _options = new List<ListViewItem>();
        }

        private List<ListViewItem> _options;
        public List<ListViewItem> Options
        {
            get { return _options; }
        } 

        public void AddOption(string message, Action logic)
        {
            var listItemToAdd = new ListViewItem {Content = message};
            listItemToAdd.Selected += (sender, e) => ListItemToAddOnMouseDown(sender, e, logic);  //attach the eventhandler
            _options.Add(listItemToAdd);
        }

        private void ListItemToAddOnMouseDown(object sender, RoutedEventArgs mouseButtonEventArgs, Action logic)
        {
            logic();
        }

    }
}
